<extend name="Public/base"/>

<block name="body">

    <script type="text/javascript" src="__PUBLIC__/Admin/js/school.js"></script>
	<div class="main-title">
		<h2>文档管理</h2>
	</div>
	
	<div class="cf">
		<div class="fl">
			<a class="btn" href="{:U('add')}">新 增</a>
			<!--
			<button class="btn ajax-post confirm" target-form="id" url="{:U("Service/del")}">删 除</button>
			-->
	
		</div>
	</div>
	
	<form action="__URL__/save" method="post" class="form-list" enctype="multipart/form-data">
	<div class="data-table table-striped">
		<table>
			<thead>
				<tr>
					<th class="row-selected">
						<input class="checkbox check-all" type="checkbox">
					</th>
					<th>ID</th>
					<th>新闻标题</th>
					<th>发布时间</th>
					<th>推荐</th>
					<th>链接地址</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="list">
				<volist name="list" id="item">
					<tr>
						<td><input class="ids row-selected" type="checkbox" name="ids[]" id="" value="{$item['id']}"> </td>
						<td>{$item.id}</td>
						<td>{$item.title}</td>
						<td>{$item.addtime|date="Y-m-d",###}</td>
						<td>{$istj[$item['is_tj']]}</td>
						<td>{:U('/Home/Article/info',array('id'=>$item['id']))}</td>
						<td>
							<a title="编辑" href="__URL__/edit/id/{$item.id}">编辑</a>
							<a class="confirm ajax-get" title="删除" href="__URL__/del/id/{$item.id}">删除</a>
						</td>
					</tr>
				</volist>
				<else/>
				<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>
	</div>
	</form>
</block>

<block name="script">
<script type="text/javascript">
    $(function() {
    	//点击排序
    	$('.list_sort').click(function(){
    		var url = $(this).attr('url');
    		var ids = $('.ids:checked');
    		var param = '';
    		if(ids.length > 0){
    			var str = new Array();
    			ids.each(function(){
    				str.push($(this).val());
    			});
    			param = str.join(',');
    		}

    		if(url != undefined && url != ''){
    			window.location.href = url + '/ids/' + param;
    		}
    	});
    });
</script>
	<script type="text/javascript">
	//搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
	</script>
</block>